package br.edu.sistemaacademico.builder.impl;


import java.util.List;

import br.edu.sistemaacademico.builder.SQLBuilder;

public class SelectSQLBuilder extends SQLBuilder{

	public String colunasToReturn;
	public String orderBy;
	
	public SelectSQLBuilder(){
		sql = new StringBuilder("select ");
	}
	@Override
	public void buildColunas() {
		sql.append(colunasToReturn+ " from ");
		sql.append(nomeTabela).append(" ");

	}
	
	public void buildColunas(List<String> colunas) {
		StringBuilder sb = new StringBuilder();
		for (int ind = 0; ind < colunas.size(); ind++) {
			sb.append(colunas.get(ind));
			if (ind < (colunas.size() - 1))
				sb.append(", ");
		}
	}

	@Override
	public void buildCondicao() {
		if(condicao==null)
			this.condicao = "";
		else
		sql.append(" where ");
		sql.append(condicao);
		if(orderBy!=null)
		sql.append(" order by "+orderBy);
	}

	@Override
	public void buildNomeTabela() {
		
	}

	@Override
	public void buildValores() {
		
	}

}
